Oracle throws some odd errors if you mistakenly use the wrong kind of quotes.
SQL> CREATE OR REPLACE FUNCTION test (p_in IN VARCHAR2) 2 RETURN NUMBER 3 AS 4 BEGIN 5 IF p_in = "" THEN 6 RETURN 0; 7 END IF; 8 END test; 9 / CREATE OR REPLACE FUNCTION test (p_in IN VARCHAR2) * ERROR at line 1: ORA-00604: error occurred at recursive SQL level 1 ORA-01400: cannot insert NULL into ("SYS"."OBJ$"."NAME")
SQL> CREATE OR REPLACE FUNCTION test (p_in IN VARCHAR2) 2 RETURN NUMBER 3 AS 4 BEGIN 5 IF p_in = '' THEN 6 RETURN 0; 7 END IF; 8 END test; 9 /
Function created.
or evenERROR at line 5:
ORA-99999: wrong quoting character used
ERROR at line 5:
ORA-ID10T: Use single quotes instead dummy!
Re:How hard is it...
runrig on 2007-08-24T23:44:45
Or to allow EITHER single or double quoting (like some databases *cough* Informix *cough* allow)? I was spoiled by learning SQL on Informix, so when I started on Oracle and MS-SQL, I cursed and then learned to change my habits. I suppose there's some sort of ANSI standard though...Re:How hard is it...
Mr. Muskrat on 2007-08-25T15:15:21
Exactly!Re:How hard is it...
Alias on 2007-08-26T01:54:54
I guess the problem with that is they have semantically different meanings.
One looks to be a constructor for literals, the other is a quote for database object names.
''
is identical to NULL
. Sowill never return true.p_in = ''
Use
instead.p_in is null
Re:Also...
Mr. Muskrat on 2007-08-25T15:14:18
You'd think that after using Oracle for a year and a half that I would remember that and yet I keep forgetting.Re:Also...
sigzero on 2007-08-25T20:04:34
No, we all forget that sometimes.